package com.margo.project.web.mvcconfig.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * AOP需要的一些概念
 * 1.通知(Advice)
 * 2.连接点(Joinpoint)
 * 3.切入点(Pointcut)
 * 4.切面(Aspect)
 * 
 * 5.引入(Introduction)
 * 6.目标(Target)
 * 7.代理(proxy)
 * 8.织入(Weaving)
 * @author fangxingbang
 *
 */
@Aspect
@Component
public class MargoAspectConfiguration {
	
	private Logger logger=LoggerFactory.getLogger(this.getClass());
	
	@Pointcut("@annotation(com.margo.project.web.mvcconfig.aspect.DataLicense)" )
    public void addAdvice(){
		
	}  
	
	@Before("addAdvice()")
	public void beforeAdvice(JoinPoint joinPoint) {
		Object[] args = joinPoint.getArgs();
		logger.info(args.toString());
	}
    
//	@Around("addAdvice()")
//    public Object Interceptor(ProceedingJoinPoint pjp){
//        Object result = null; 
//        //Object[] args = pjp.getArgs();
//        logger.info("切面"); 
//        try {
//            result =pjp.proceed();
//        } catch (Throwable e) {
//            e.printStackTrace();
//        }  
//        return result;
//    }
}
